/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 17655
 * Date: 2024-11-26
 * Time: 12:06
 */
public class test1 {
    /*
    NewCoder BM8 链表中倒数最后k个结点
     */
    int size=0;
    public ListNode FindKthToTail (ListNode pHead, int k) {
        // write code here
        if(pHead==null){
            return pHead;
        }
        ListNode node = FindKthToTail(pHead.next,k);
        size++;
        if(size==k){
            return pHead;
        }
        return node;
    }


    public class ListNode {
        int val;
        ListNode next = null;

        public ListNode(int val) {
            this.val = val;
        }
    }
}
